using System;
using System.Collections.Generic;
using Castle.ActiveRecord.Framework;
using NHibernate.Expression;

namespace CosyTrade.Data
{
    public interface IDataAccess
    {
        void Initialize(IConfigurationSource source, params Type[] ormTypes);
        
        void Create(BusinessObject instance);
        void Save(BusinessObject instance);
        void Delete(BusinessObject instance);

        T FindByPrimaryKey<T>(Guid primaryKey);
        object FindByPrimaryKey(Type type, Guid primaryKey);

        T FindOne<T>(params ICriterion[] criterion);
        T FindOne<T>(DetachedCriteria criterion);
        IList<T> FindAll<T>(params ICriterion[] criterias);
        IList<T> FindAll<T>(Order[] orderBy, params ICriterion[] criterias);
        IList<T> SlicedFindAll<T>(int firstResult, int maxResult, params ICriterion[] criterias);
        IList<T> SlicedFindAll<T>(int firstResult, int maxResult, Order[] orderBy, params ICriterion[] criterias);

        object UniqueResult(Type type, DetachedCriteria detachedCriteria);
    }
}